package cn.aifeix.lxyc.fallback;

import cn.aifeix.lxyc.feign.ShopService;
import cn.aifeix.lxyc.enums.GlobalErrorCodeEnum;
import cn.aifeix.lxyc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class ShopServiceFallbackFactory implements FallbackFactory<ShopService> {
    @Override
    public ShopService create(Throwable throwable) {
        return new ShopService() {
            @Override
            public JSONResult list() {
                return JSONResult.error(GlobalErrorCodeEnum.FALLBACK);
            }
        };
    }
}
